/*
 * @Author: HuangBingQuan <17671241237@163.com>
 * @Date: 2024-03-09 23:36:34
 * @LastEditTime: 2024-03-09 23:57:30
 * @FilePath: /san-zi-qi/src/components/GameStatusComp/GameStatusComp.tsx
 */
import React from 'react'

import "./GameStatusComp.scss";
import { ChessType, GameStatus } from '../../type/enums';

interface IProps{
    status: GameStatus,
    next: ChessType.red | ChessType.black
}

export default function GameStatusComp(props: IProps) {
    let content: JSX.Element;
    // 如果游戏没有结束
    if(props.status === GameStatus.gaming) {
        content = props.next === ChessType.red ? 
            <div className='next red'>红方落子</div> : 
                <div className='next blank'>黑方落子</div>
    }else {
        content = props.status === GameStatus.redWin ? 
            <div className='win red'>红方胜利</div> : 
                props.status === GameStatus.blackWin ? 
                    <div className='win black'>黑方胜利</div>: <div className='win equal'>平局</div>;
    }
    return (
        <div className='status'>
            { content }
        </div>
    )
}